package model;

import java.io.Serializable;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import beans.TripCatBean;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class VrstaPrevoza implements Serializable {

	private static final long serialVersionUID = -7356068229316923551L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key sifra;

	private String naziv;

	public VrstaPrevoza() {
		super();
	}

	public VrstaPrevoza(String naziv) {
		super();
		this.naziv = naziv;
	}

	public VrstaPrevoza(Key sifra, String naziv) {
		super();
		this.sifra = sifra;
		this.naziv = naziv;
	}

	public Key getSifra() {
		return sifra;
	}

	public void setSifra(Key sifra) {
		this.sifra = sifra;
	}

	public String getNaziv() {
		return naziv;
	}

	public void setNaziv(String naziv) {
		this.naziv = naziv;
	}
	
	public TripCatBean toTripCatBean(){
		return new TripCatBean(Integer.valueOf((int)sifra.getId()), naziv);
	}
	
	@Override
	public String toString() {		
		return "VrstaPrevoza - ID: " + sifra + " , naziv: " + naziv;
	}
}
